
###############################################################################
## Copyright 2010 Intel Corporation All Rights Reserved.                     ##
##                                                                           ##
## The source code, information and material ("Material") contained herein   ##
## is owned by Intel Corporation or its suppliers or licensors, and title to ##
## such Material remains with Intel Corporation or its suppliers or          ##
## licensors.                                                                ##
## The Material contains proprietary information of Intel or its suppliers   ##
## and licensors. The Material is protected by worldwide copyright laws and  ##
## treaty provisions. No part of the Material may be used, copied,           ##
## reproduced, modified, published, uploaded, posted, transmitted,           ##
## distributed or disclosed in any way without Intel's prior express written ##
## permission. No license under any patent, copyright or other intellectual  ##
## property rights in the material is granted to or conferred upon you,      ##
## either expressly, by implication, inducement, estoppel or otherwise. Any  ##
## license under such intellectual property rights must be express and       ##
## approved by Intel in writing.                                             ##
###############################################################################


# Optionally override the default compiler (g++) or default build target (release)
# CXX := icpc
# ARBB_CXXFLAGS := -g

# Optionally override the default Intel(R) ArBB path, or architecture (auto-detected)
# ARBB_IA := ia32
# ARBB_ROOT := $(HOME)/arbb

ifndef ARBB_ROOT
  ARBB_ROOT := $(HOME)/usr/bin/arbb
endif

# Select a default C++ compiler if unspecified
ifndef CXX
  CXX := g++
endif

ifndef ARBB_IA
  # Detect the default architecture.
  ARCH := $(shell uname -m)
  
  ifeq ($(ARCH), x86_64)
    ARBB_IA := intel64
  else
    ARBB_IA := ia32
  endif
endif

LDFLAGS := -L$(ARBB_ROOT)/lib/$(ARBB_IA) -larbb -ltbb -littnotify

CXXFLAGS += $(ARBB_CXXFLAGS)
CXXFLAGS += -I$(ARBB_ROOT)/include
CXXFLAGS += -Wall
ifeq ($(findstring $icpc, $(CXX)), $icpc)
  CXXFLAGS += -diag-disable remark
endif

OBJECTS := $(SOURCES:.cpp=.o)

all: $(PROGRAM)

$(PROGRAM): $(OBJECTS)
	$(CXX) $(CXXFLAGS) $(OBJECTS) -o $@ $(LDFLAGS)

clean: 
	rm -f *.o $(PROGRAM)
